<template>
	<view style="height: 100vh; background-color: #FFFFFF;">
		 <u-navbar  title-color="#FFFFFF" height="48" back-icon-color="#FFFFFF" :border-bottom="false" :is-fixed="true" title="选择通知"
		></u-navbar>
		<u-form ref="enterpriseForm" :model="enterpriseForm" label-width="100px" class="wrap">
			<u-form-item label-position="left" label="是否通知自己" prop="isInformYourself" >
			  <u-switch v-model="enterpriseForm.isInformYourself "></u-switch>
			</u-form-item>
			<u-form-item label-position="left" label="是否通知警务" prop="isInformOthers" v-if="hiddenButton">
			  <u-switch v-model="enterpriseForm.isInformOthers "></u-switch>
			</u-form-item>
			<u-form-item label-position="left" label="是否通知消防" prop="isInformOthers" v-if="hiddenButton1">
			  <u-switch v-model="enterpriseForm.isInformOthers"></u-switch>
			</u-form-item>
		</u-form>	
		<u-button @click="submit" type="primary" style="margin: 24rpx;">确认演练</u-button>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				enterpriseForm: {
					
				},
				enterpriseShow:false,
				enterpriseList:[],
				defaultValue: [],				
			}
		},
		computed:{
			hiddenButton(){
				let roleCode = this.$store.getters.roleCode;
				return roleCode=="XFZD-ADMIN"||roleCode=="XT-ADMIN"||roleCode=="ZD-ADMIN"||roleCode=="DD-ADMIN"||roleCode=="XZ-ADMIN"
			},
			hiddenButton1(){
				let roleCode = this.$store.getters.roleCode;
				return roleCode=="XFZD-ADMIN"||roleCode=="XT-ADMIN"||roleCode=="JW-ADMIN"||roleCode=="XZ-ADMIN"
			}
		},
		onLoad(e) {
		},
		onShow() {
			this.initView()
		},
		methods: {
			initView() {
				this.getInEnterpriseDominantConfig()
			},
			getInEnterpriseDominantConfig() {
				this.utils.request("/api/app/enterpriseDominant/getInEnterpriseDominantConfig", {}, "post", "app", true).then(res => {
					this.enterpriseForm = res.data
				}).catch(error => {
					console.log(error)
				})
			},
			submit() {
				this.$refs.enterpriseForm.validate(valid => {
					if (valid) {
						this.utils.request("/api/app/enterpriseDominant/updateEnterpriseDominantConfig", this.enterpriseForm,
							"post", "app", true).then(res => {
							uni.navigateTo({
								url: "/pages/index/drill/drillNotice"
							})
						}).catch(error => {
							console.log(error)
						})
					} else {
						console.log("验证失败")
					}
				})
			},

		}
	}
</script>

<style>

</style>
